<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心 - 校园二手书交易平台</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <style>
        .dashboard-card {
            margin-bottom: 20px;
            transition: transform 0.3s;
        }
        .dashboard-card:hover {
            transform: translateY(-5px);
        }
        .dashboard-icon {
            font-size: 2.5rem;
            margin-bottom: 15px;
            color: #4caf50;
        }
        .stats-card {
            background-color: #f8f9fa;
            padding: 20px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .stats-number {
            font-size: 2rem;
            font-weight: bold;
            color: #4caf50;
        }
        .navbar-nav .nav-item {
            margin-right: 15px;
        }
        .footer {
            background-color: #343a40;
            color: white;
            padding: 30px 0;
            margin-top: 50px;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">校园二手书交易平台</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/}">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/book/list}">书籍列表</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/book/publish}">发布书籍</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/book/my-books}">我的书籍</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/order/my-orders}">我的订单</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown">
                            <span sec:authentication="name"></span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            <a class="dropdown-item" th:href="@{/user/profile}">个人信息</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" th:href="@{/logout}">退出登录</a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 页面内容 -->
    <div class="container mt-4">
        <h2>欢迎回来，<span sec:authentication="name">用户名</span>！</h2>
        <p class="lead">这是您的个人控制面板，您可以在这里管理您的二手书交易活动。</p>

        <!-- 统计信息 -->
        <div class="row mt-4">
            <div class="col-md-3">
                <div class="stats-card text-center">
                    <div class="stats-number" th:text="${stats.onSaleBooks}">0</div>
                    <div>我的在售书籍</div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stats-card text-center">
                    <div class="stats-number" th:text="${stats.soldBooks}">0</div>
                    <div>已售出书籍</div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stats-card text-center">
                    <div class="stats-number" th:text="${stats.pendingOrders}">0</div>
                    <div>待处理订单</div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stats-card text-center">
                    <div class="stats-number" th:text="${stats.completedOrders}">0</div>
                    <div>已完成订单</div>
                </div>
            </div>
        </div>

        <!-- 快捷操作 -->
        <h3 class="mt-5">快捷操作</h3>
        <div class="row mt-4">
            <div class="col-md-4">
                <div class="card dashboard-card text-center">
                    <div class="card-body">
                        <div class="dashboard-icon">📚</div>
                        <h5 class="card-title">发布书籍</h5>
                        <p class="card-text">上架您的二手书籍，设置合理的价格和详细的描述，吸引更多买家</p>
                        <a th:href="@{/book/publish}" class="btn btn-success">立即发布</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card dashboard-card text-center">
                    <div class="card-body">
                        <div class="dashboard-icon">📋</div>
                        <h5 class="card-title">管理书籍</h5>
                        <p class="card-text">查看和管理您发布的所有书籍，包括编辑信息、下架或重新上架</p>
                        <a th:href="@{/book/my-books}" class="btn btn-success">去管理</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card dashboard-card text-center">
                    <div class="card-body">
                        <div class="dashboard-icon">📦</div>
                        <h5 class="card-title">订单管理</h5>
                        <p class="card-text">查看您的购买订单和销售订单，处理待付款、待发货等状态的订单</p>
                        <a th:href="@{/order/my-orders}" class="btn btn-success">查看订单</a>
                    </div>
                </div>
            </div>
        </div>

        <!-- 最近交易 -->
        <h3 class="mt-5">最近交易</h3>
        <div class="alert alert-info mt-3">
            您还没有任何交易记录。开始<a href="/book/list" class="alert-link">浏览书籍</a>或<a href="/book/publish" class="alert-link">发布书籍</a>来开始交易吧！
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <h5>关于我们</h5>
                    <p>校园二手书交易平台是为高校学生设计的便捷二手书交易系统，旨在促进校园内书籍的循环利用，降低学习成本。</p>
                </div>
                <div class="col-md-4">
                    <h5>快速链接</h5>
                    <ul class="list-unstyled">
                        <li><a th:href="@{/}" class="text-white">首页</a></li>
                        <li><a th:href="@{/book/list}" class="text-white">书籍列表</a></li>
                        <li><a th:href="@{/book/publish}" class="text-white">发布书籍</a></li>
                        <li><a th:href="@{/book/my-books}" class="text-white">我的书籍</a></li>
                    </ul>
                </div>
                <div class="col-md-4">
                    <h5>联系我们</h5>
                    <address>
                        <strong>校园二手书交易平台</strong><br>
                        邮箱: contact@booktrading.com<br>
                        电话: (123) 456-7890
                    </address>
                </div>
            </div>
            <hr class="bg-light">
            <div class="text-center">
                <p>&copy; 2023 校园二手书交易平台. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
</body>
</html> 